﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>角色分配</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/Jqbox.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../js/ligerui.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="../Js/conmon.js" type="text/javascript"></script>
    <script type="text/javascript">
        var $grid;
        var maiheight = 500;
        var $selectRow = null;
        var vUrl = null;
        $(function () {
            maiheight = $(window).height();

            $("#layout1").ligerLayout({ leftWidth: 170, heightDiff: -0 });

            //显示gride
            $grid = $("#maingrid").ligerGrid({
                columns: [
               { display: '序号', align: 'left', width: 40, type: 'int', isSort: false,
                   render: function (item, i) {
                       i = i + 1;
                       return i;
                   }
               },
                { display: '职务名称', name: 'R_NAME', align: 'left', width: 80 },
                { display: '备注', name: 'R_REMARK', width: 200 },
                { display: '创建日期', name: 'R_DATE', type: 'date', dateFormat: "yyyy-MM-dd", width: 80 },
                { display: '区域', name: 'A_NAME', width: 130 },

                  { display: '状态', name: 'R_POWER', isSort: false, width: 60,
                      render: function (item) {
                          if (item.R_POWER == 0) return "普通员";
                          else if (item.R_POWER == 1) return "管理员";
                          else
                          return "";
                      }
                  }


                ],
                parms: [{ name: 'rolName', value: $("#txtrolName").val() }, { name: 'aid', value: '0 ' }, { name: 'fileName', value: 'UserTable'}],
                dataAction: 'server', pageSize: 20,
                url: '../WebServer/MainAdmin.ashx?Action=AreaRoleList',
                sortName: 'R_NAME',
                width: '100%', height: '95%',
                onDblClickRow: function (data, rowindex, rowobj) {
                    $selectRow = data;
                    ShowDialog("admin/UpdateRole.htm", "编辑", 300, 300);
                }

            });

            loadTree();
        });

        function loadTree() {
            $("#Orgtree").ligerTree({
                checkbox: false,
                slide: false,
                nodeWidth: 100,
                url: '../WebServer/MainAdmin.ashx?Action=AreaTree&rnd=' + Math.random(),
                onSelect: function (node) {
                    if (node.data.id) {
                        $("#Aid").val(node.data.id);
                        $("#txtrolName").val("");
                        loadGrid();
                    }
                }
            });
        }
        function Search() {
            loadGrid();
        }
      
        function loadGrid() {
            if (!$grid) return;
            $("tbody > tr", $grid.gridbody).each(function () {
                $(this).remove();
            });
            $grid.setOptions({ parms: [{ name: 'rolName', value: $("#txtrolName").val() }, { name: 'aid', value: $("#Aid").val() }, { name: 'fileName', value: 'UserTable'}], newPage: 1, Rows: [], Total: 0 });   //设置数据参数

            $grid.loadData(true); //加载数据

        }

        function AddRole() {
            ShowDialog("admin/FenRole.htm", "编辑", 300, 300);
        }
       
    </script>
     <style type="text/css"> 
 
            body{ padding:5px; margin:0; padding-bottom:15px;}
            #layout1{  width:100%;margin:0; padding:0;  }  
            .l-page-top{ height:80px; background:#f8f8f8; margin-bottom:3px;}
            h4{ margin:20px;}
  </style>
  
</head>
<body style="padding:10px">

     <div id="layout1">
            <div position="left" title="">
              <ul id="Orgtree"></ul>
            </div><!-- end-->
            <div  position="center" title="">
             <div id="toptoolbar"></div> 
            <div class="l-panel-search">
                <div class="l-panel-search-item">
                   <span>名称：</span>
                </div>
                <div class="l-panel-search-item">
                    <input id="txtrolName" type="text" ltype="text" />
                </div>
                 
                <div class="l-panel-search-item">
                    <a  class="l-button" style="width:60px; float:left; margin-left:10px;"   onclick="Search()">查询</a>&nbsp;
                   
                </div>

                  <div class="l-panel-search-item">
                    <a  class="l-button" style="width:60px; float:left; margin-left:10px;"   onclick="AddRole()">添加职务</a>&nbsp;
                     <label>&nbsp;&nbsp;(<font color="red">注：双击行进行编辑</font>)</label>
                </div>
                
            </div>
               <div id="maingrid">
               </div> 
            </div>
             

   </div> 
   <a id="ExdcleGo" href=""></a>
   <input type="hidden" id="Aid" value="0" />
   <input type="hidden" id="Rid" value="0" />
 
</body>
</html>
